package com.corx.network.core.type;


/**
 * @author gx
 * @version 1.0.0
 */

public enum StorageTypeEnum {

    /**
     * MySql类型
     */
    MYSQL("MySql类型", "mysql"),
    /**
     * Redis类型
     */
    REDIS("Redis类型", "redis"),
    ;

    /**
     * 名称
     */
    private final String name;


    /**
     * 类型
     */
    private final String type;


    StorageTypeEnum(String name, String type) {
        this.name = name;
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public String getType() {
        return type;
    }

    /**
     * 获取存储类型枚举
     *
     * @param type type
     * @return MessageStorageType
     */
    public static StorageTypeEnum getByType(String type) {
        for (StorageTypeEnum storageType : StorageTypeEnum.values()) {
            if (storageType.getType().equals(type)) {
                return storageType;
            }
        }
        throw new IllegalArgumentException("Invalid MessageStorageType type: " + type);
    }


}
